package com.efuture.netrequestdemo.ui

import android.os.Bundle
import android.view.View
import com.efuture.netrequestdemo.R
import com.efuture.netrequestdemo.buiness.UserBuiness
import com.efuture.netrequestdemo.utils.AppUtils
import kotlinx.coroutines.*

class MainActivity : BaseActivity() {
    val mainScope = MainScope()

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
        AppUtils.setCurrentActivity(this@MainActivity)
    }

    //post请求
    fun postRequest(view: View) {

        UserBuiness.instance.userRegister(mainScope)

    }
    //get请求
    fun getRequest(view: View) {

        UserBuiness.instance.getProjectData(mainScope)

    }

    override fun onDestroy() {
        super.onDestroy()
        mainScope.cancel()
    }

}